def sdes_p10(key):
    """
    Permutation of the 10-bit key.

    Input: key: binary
    Ouput: key_permute: binary
    """
    key_permute = 0
    permutation = [6, 1, 2, 1, 3, 4, 3, 1, 1, 4]  # Number of positions to shift each bit
    for i in range(0,10):
        if i not in [2, 4, 6, 8, 9]:
            key_permute |= (key & 2**(9-i)) >> permutation[i]
        else:
            key_permute |= (key & 2**(9-i)) << permutation[i]
    return key_permute

def sdes_ls1(key):
    """
    Rotate the first five bits left one position, rotate the second five bits left one position.

    Input: key: binary
    Output: key_rotate: binary
    """
    upper_bits = key >> 5
    top_value = (upper_bits & 2**4) >> 4
    upper_bits = ((upper_bits << 1) & 31) | top_value
    lower_bits = key & 31
    top_value = (lower_bits & 2**4) >> 4
    lower_bits = ((lower_bits << 1) & 31) | top_value
    key_rotate = (upper_bits << 5) | lower_bits
    return key_rotate
